package com.hgyc.mom.mes.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.hgyc.mom.mes.entity.MesWorkshopMachine;
import com.hgyc.mom.mes.service.MesWorkshopMachineService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 车间建模设备信息 Controller
 *
 * @author fwj
 * @since 2025-06-23
 */
@Tag(name = "车间建模设备信息 控制器", description = "车间建模设备信息 控制器")
@RestController
@RequestMapping("/mes/workshop/machine")
public class MesWorkshopMachineController {
    @Autowired
    private MesWorkshopMachineService mesWorkshopMachineService;


    @Operation(summary = "查询车间建模设备信息 树列表", description = "查询车间建模设备信息 树列表")
    @PostMapping("/list")
    public Result<List<MesWorkshopMachine>> pageList(@Parameter(description = "查询参数") @RequestBody MesWorkshopMachine mesWorkshopMachine) {
        QueryWrapper<MesWorkshopMachine> wrapper = QueryWrapperUtil.build(mesWorkshopMachine);
        List<MesWorkshopMachine> list = mesWorkshopMachineService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取车间建模设备信息 详细信息", description = "获取车间建模设备信息 详细信息")
    @GetMapping(value = "/{id}")
    public Result getInfo(@Parameter(description = "车间建模设备信息 ID") @PathVariable("id") Long id) {
        return Result.success(mesWorkshopMachineService.getById(id));
    }

}